/*
NOTES TO DATA ANALYSIS:
*/

clear all
set more off
capture log close
********************************************************************************

use "$covidclean/smscovid_clean.dta", clear

***Keep relevant observations: consent taken and above 18 years of age, non-missing treatment arms
	keep if consent==1 & age>=18
	keep if ~missing(treatment_arm)
	count //3964

***HOUSEKEEPING - BEHAVIOR TREATMENTS, OUTCOMES, ROW TITLES

	***Create dummies with treatment arms interacted with behavior
		foreach v in $treat_pool $treat_frames $treat_timings $treat_arms {
			gen `v'_sd = `v'*behavior_sd
			gen `v'_hw = `v'*behavior_hw
		}
		
	***Outcomes
		global keysdhw know_sd act_sd know_hw act_hw
		
	***Row titles
		global rtitle_pooled_pd "Treatment - SD x  Middle Period \ "" \ "" \ Treatment - SD x  Late Period \  "" \ "" \ Treatment - HW x Middle Period \ "" \ "" \ Treatment - HW x Late Period \ "" \ "" "
		global rtitle_pooled_sms "Treatment - SD x Read SMS  \ "" \ "" \ Treatment - HW x  Read SMS \ "" \ "" "
		global rtitle_pooled_r "Treatment - SD x 5-day Recall \ "" \ "" \ Treatment - HW x 5-day Recall \ "" \ "" "
		global rtitle_pooled_age "Treatment - SD x Above Median Age  \ "" \ "" \ Treatment - HW x  Above Median Age \ "" \ "" "
		global rtitle_pooled_unemp "Treatment - SD x Unemployed \ "" \ "" \ Treatment - HW x Unemployed \ "" \ "" "
		
********************************************************************************
***HETEROGENEITY BY EARLY, MID OR LATE PERIODS
********************************************************************************

	*Create dummies for early, mid, late periods of the experiment
	gen period = 1 if roundofinterview<6
	replace period = 2 if roundofinterview>5 & roundofinterview<11
	replace period = 3 if roundofinterview>10 
	tab period roundofinterview
	la def period 1"Round 1 to 5" 2"Round 6 to 10" 3"Round 11 to 14"
	la val period period
		
		*Regression
		qui foreach v of varlist $keysdhw {
			
				*Control mean
				mean `v' if treatment_pooled==0 & $sample
				mat mean = r(table)
				local c_mean : di %9.2f mean[1,1]
			
				noi reghdfe `v' $treat_pool_sd##period $treat_pool_hw##period if $sample, a($studycontrols $covariates) vce(robust)
		
				mat b = r(table)
				local j = 10
				forval i = 1/2 {
					local b_`i' = b[1,`j'] //beta
					local se_`i' = b[2,`j'] //asymptotic s.e.
					local a_p_`i' = b[4,`j'] //asymptotic p-value
					local p_`i' = 0 //exact p-value
					local j = `j' + 1
				}
				
				local j = 18
				forval i = 3/4 {
					local b_`i' = b[1,`j'] //beta
					local se_`i' = b[2,`j'] //asymptotic s.e.
					local a_p_`i' = b[4,`j'] //asymptotic p-value
					local p_`i' = 0 //exact p-value
					local j = `j' + 1
				}
				
				local n : di %9.0fc e(N)
				local r2_a : di %9.2f e(r2_a)
				
				/*Create matrices to store estimates from Randomization inference 
				mat `v'_pd_ri_b = J(4,$nbatch,.)
				mat `v'_pd_ri_se = J(4,$nbatch,.)
				mat `v'_pd_ri_p = J(4,$nbatch,.)*/
				
				*Randomization inference using RI dataset created
				preserve
    				forval batch = 1/$nbatch {
					   use if batch == `batch' using "$rianalysis/ri_data_final", clear
					   *use if batch == `batch' using ri_data_final, clear
					   noi di "Running hetero analysis by period for `v' for batch - `batch' at time: `c(current_time)'"
					   *Create periods
					   gen period = 1 if roundofinterview<6
					   replace period = 2 if roundofinterview>5 & roundofinterview<11
					   replace period = 3 if roundofinterview>10					   
    				   reghdfe `v' $treat_pool_sd##period $treat_pool_hw##period if $sample, a($studycontrols $covariates) vce(robust) 
    				   mat ri_b = r(table)
					   local j = 10
    				   forval i = 1/2 {
            			   local ri_b_`i' = ri_b[1,`j']
						   /*mat `v'_pd_ri_b[`i',`batch'] = ri_b[1,`i'] //beta
						   mat `v'_pd_ri_se[`i',`batch'] = ri_b[2,`i'] //asymptotic s.e.
					       mat `v'_pd_ri_p[`i',`batch'] = ri_b[4,`i'] //asymptotic p-value*/
            			   *Two-tailed comparison
				           if abs(`ri_b_`i'') >= abs(`b_`i'') local p_`i' = `p_`i'' + 1 
						   local j = `j' + 1
					    } 
					   local j = 18
    				   forval i = 3/4 {
            			   local ri_b_`i' = ri_b[1,`j']
						   /*mat `v'_pd_ri_b[`i',`batch'] = ri_b[1,`i'] //beta
						   mat `v'_pd_ri_se[`i',`batch'] = ri_b[2,`i'] //asymptotic s.e.
					       mat `v'_pd_ri_p[`i',`batch'] = ri_b[4,`i'] //asymptotic p-value*/
            			   *Two-tailed comparison
				           if abs(`ri_b_`i'') >= abs(`b_`i'') local p_`i' = `p_`i'' + 1 
						   local j = `j' + 1
					    }
				    } 
				restore
				
				*Compute Exact p-values 
				forval i = 1/4 {
					local p_`i' = `p_`i''/$nbatch
				}
				
				*Imputing coefficients, asymptotic and exact p-values in the output matrix
				mat `v'_pd = J(4,3,.)
				forval i = 1/4 {
					mat `v'_pd[`i',1] = round(`b_`i'',0.001)
					mat `v'_pd[`i',2] = round(`se_`i'',0.001)
					mat `v'_pd[`i',3] = round(`p_`i'',0.001)
				}
				
				*Statistical significance
				mat stars = J(4,3,.)
				forval i = 1/4 {
					mat stars[`i',2] = 0
					mat stars[`i',3] = 0
					if (`a_p_`i'' < 0.1)  mat stars[`i',1] = 1
					else mat stars[`i',1] = 0
					if (`a_p_`i'' < 0.05) mat stars[`i',1] = 2 
					if (`a_p_`i'' < 0.01) mat stars[`i',1] = 3 
				}

				*Save matrix
				matsave `v'_pd, replace saving path($tables)
				/*matsave `v'_pd_ri_b, replace saving path($tables)
				matsave `v'_pd_ri_se, replace saving path($tables)
				matsave `v'_pd_ri_p, replace saving path($tables)*/
				*matload `v'_pd, path($tables) saving
				
				*Output 
				frmttable, statmat(`v'_pd) store(`v'_pd) substat(2) annotate(stars) asymbol(*,**,***) rtitle($rtitle_pooled_pd)  /// 
				addrows("Adjusted $ R^2$", `r2_a' \ N, "`n'" \ "Control Mean", `c_mean') sdec(3,3,3)
		
		}
	
********************************************************************************
***HETEROGENEITY BY LITERACY
********************************************************************************

	tab smsread //85% can read SMS in Hindi
					
		*Regression
		qui foreach v of varlist $keysdhw {
			
				*Control mean
				mean `v' if treatment_pooled==0 & $sample
				mat mean = r(table)
				local c_mean : di %9.2f mean[1,1]
			
				noi reghdfe `v' $treat_pool_sd##smsread $treat_pool_hw##smsread if $sample, a($studycontrols $covariates) vce(robust)
	
				mat b = r(table)
				local j = 8
				forval i = 1/2 {
					local b_`i' = b[1,`j'] //beta
					local se_`i' = b[2,`j'] //asymptotic s.e.
					local a_p_`i' = b[4,`j'] //asymptotic p-value
					local p_`i' = 0 //exact p-value
					local j = `j' + 6
				}
				
				local n : di %9.0fc e(N)
				local r2_a : di %9.2f e(r2_a)
				
				/*Create matrices to store estimates from Randomization inference 
				mat `v'_sms_ri_b = J(2,$nbatch,.)
				mat `v'_sms_ri_se = J(2,$nbatch,.)
				mat `v'_sms_ri_p = J(2,$nbatch,.)*/
				
				*Randomization inference using RI dataset created
				preserve
    				forval batch = 1/$nbatch {
					   use if batch == `batch' using "$rianalysis/ri_data_final", clear					   
    				   *use if batch == `batch' using ri_data_final, clear
					   noi di "Running hetero analysis by literacy for `v' for batch - `batch' at time: `c(current_time)'"
    				   reghdfe `v' $treat_pool_sd##smsread $treat_pool_hw##smsread if $sample, a($studycontrols $covariates) vce(robust) 
    				   mat ri_b = r(table)
					   local j = 8
    				   forval i = 1/2 {
            			   local ri_b_`i' = ri_b[1,`j']
						   /*mat `v'_sms_ri_b[`i',`batch'] = ri_b[1,`i'] //beta
						   mat `v'_sms_ri_se[`i',`batch'] = ri_b[2,`i'] //asymptotic s.e.
					       mat `v'_sms_ri_p[`i',`batch'] = ri_b[4,`i'] //asymptotic p-value*/
            			   *Two-tailed comparison
				           if abs(`ri_b_`i'') >= abs(`b_`i'') local p_`i' = `p_`i'' + 1 
						   local j = `j' + 6
					    }  
				    } 
				restore
				
				*Compute Exact p-values 
				forval i = 1/2 {
					local p_`i' = `p_`i''/$nbatch
				}
				
				*Imputing coefficients, asymptotic and exact p-values in the output matrix
				mat `v'_sms = J(2,3,.)
				forval i = 1/2 {
					mat `v'_sms[`i',1] = round(`b_`i'',0.001)
					mat `v'_sms[`i',2] = round(`se_`i'',0.001)
					mat `v'_sms[`i',3] = round(`p_`i'',0.001)
				}
				
				
				*Statistical significance
				mat stars = J(2,3,.)
				forval i = 1/2 {
					mat stars[`i',2] = 0
					mat stars[`i',3] = 0
					if (`a_p_`i'' < 0.1)  mat stars[`i',1] = 1
					else mat stars[`i',1] = 0
					if (`a_p_`i'' < 0.05) mat stars[`i',1] = 2 
					if (`a_p_`i'' < 0.01) mat stars[`i',1] = 3 
				}

				*Save matrix
				matsave `v'_sms, replace saving path($tables)
				/*matsave `v'_sms_ri_b, replace saving path($tables)
				matsave `v'_sms_ri_se, replace saving path($tables)
				matsave `v'_sms_ri_p, replace saving path($tables)*/
				*matload `v'_sms, path($tables) saving
				
				*Output 
				frmttable, statmat(`v'_sms) store(`v'_sms) substat(2) annotate(stars) asymbol(*,**,***) rtitle($rtitle_pooled_sms)  /// 
				addrows("Adjusted $ R^2$", `r2_a' \ N, "`n'" \ "Control Mean", `c_mean') sdec(3,3,3)
				
		}
		
********************************************************************************
***HETEROGENEITY BY THREE-DAY RECALL VERSUS FIVE DAY RECALL
********************************************************************************
	
	cap drop fifthday
	gen fifthday = 0 if ~missing(interviewlag) | treatment_pooled==0
	replace fifthday = 1 if interviewlag==5 
	tab fifthday interviewlag, mi
	gen treat_sd_fifth = treatment_pooled_sd*fifthday
	gen treat_hw_fifth = treatment_pooled_hw*fifthday
	global newsample "(interviewlag==3 | interviewlag==5 | interviewdelta==0)"
	
	*Regression
		qui foreach v of varlist $keysdhw {
			
				*Control mean
				mean `v' if treatment_pooled==0 & $newsample
				mat mean = r(table)
				local c_mean : di %9.2f mean[1,1]
			
				noi reghdfe `v' $treat_pool_sd $treat_pool_hw treat_sd_fifth treat_hw_fifth if $newsample, a($studycontrols $covariates) vce(robust)
		
				mat b = r(table)
				local j = 3
				forval i = 1/2 {
					local b_`i' = b[1,`j'] //beta
					local se_`i' = b[2,`j'] //asymptotic s.e.
					local a_p_`i' = b[4,`j'] //asymptotic p-value
					local p_`i' = 0 //exact p-value
					local j = `j' + 1
				}
				
				local n : di %9.0fc e(N)
				local r2_a : di %9.2f e(r2_a)
				
				/*Create matrices to store estimates from Randomization inference 
				mat `v'_recall_ri_b = J(2,$nbatch,.)
				mat `v'_recall_ri_se = J(2,$nbatch,.)
				mat `v'_recall_ri_p = J(2,$nbatch,.)*/
				
				*Randomization inference using RI dataset created
				preserve
    				forval batch = 1/$nbatch {
					   use if batch == `batch' using "$rianalysis/ri_data_final", clear					   
    				   *use if batch == `batch' using ri_data_final, clear
					   noi di "Running hetero analysis by recall for `v' for batch - `batch' at time: `c(current_time)'"
					   gen fifthday = 0 if ~missing(interviewlag) | treatment_pooled==0
					   replace fifthday = 1 if interviewlag==5 
					   gen treat_sd_fifth = treatment_pooled_sd*fifthday
					   gen treat_hw_fifth = treatment_pooled_hw*fifthday
    				   reghdfe `v' $treat_pool_sd $treat_pool_hw treat_sd_fifth treat_hw_fifth if $newsample, a($studycontrols $covariates) vce(robust) 
    				   mat ri_b = r(table)
					   local j = 3
    				   forval i = 1/2 {
            			   local ri_b_`i' = ri_b[1,`j']
						   /*mat `v'_recall_ri_b[`i',`batch'] = ri_b[1,`i'] //beta
						   mat `v'_recall_ri_se[`i',`batch'] = ri_b[2,`i'] //asymptotic s.e.
					       mat `v'_recall_ri_p[`i',`batch'] = ri_b[4,`i'] //asymptotic p-value*/
            			   *Two-tailed comparison
				           if abs(`ri_b_`i'') >= abs(`b_`i'') local p_`i' = `p_`i'' + 1 
						   local j = `j' + 1
					    }  
				    } 
				restore
				
				
				*Compute Exact p-values 
				forval i = 1/2 {
					local p_`i' = `p_`i''/$nbatch
				}
				
				*Imputing coefficients, asymptotic and exact p-values in the output matrix
				mat `v'_recall = J(2,3,.)
				forval i = 1/2 {
					mat `v'_recall[`i',1] = round(`b_`i'',0.001)
					mat `v'_recall[`i',2] = round(`se_`i'',0.001)
					mat `v'_recall[`i',3] = round(`p_`i'',0.001)
				}
				
				
				*Statistical significance
				mat stars = J(2,3,.)
				forval i = 1/2 {
					mat stars[`i',2] = 0
					mat stars[`i',3] = 0
					if (`a_p_`i'' < 0.1)  mat stars[`i',1] = 1
					else mat stars[`i',1] = 0
					if (`a_p_`i'' < 0.05) mat stars[`i',1] = 2 
					if (`a_p_`i'' < 0.01) mat stars[`i',1] = 3 
				}

				*Save matrix
				matsave `v'_recall, replace saving path($tables)
				/*matsave `v'_recall_ri_b, replace saving path($tables)
				matsave `v'_recall_ri_se, replace saving path($tables)
				matsave `v'_recall_ri_p, replace saving path($tables)*/
				*matload `v'_recall, path($tables) saving
				
				*Output 
				frmttable, statmat(`v'_recall) store(`v'_recall) substat(2) annotate(stars) asymbol(*,**,***) rtitle($rtitle_pooled_r) /// 
				addrows("Adjusted $ R^2$", `r2_a' \ N, "`n'" \ "Control Mean", `c_mean') sdec(3,3,3)	
		
			}	

			
			
********************************************************************************
***HETEROGENEITY BY AGE
********************************************************************************

	count if missing(age) //123
	summ age, d //median age 28
	xtile age_med = age if ~missing(age), nq(2)
	recode age_med (1=0) (2=1)
	tab age_med, mi
	
	*Regression
		qui foreach v of varlist $keysdhw {
			
				*Control mean
				mean `v' if treatment_pooled==0 & $sample
				mat mean = r(table)
				local c_mean : di %9.2f mean[1,1]
			
				noi reghdfe `v' $treat_pool_sd##age_med $treat_pool_hw##age_med if $sample, a($studycontrols $covariates) vce(robust)
		
				mat b = r(table)
				local j = 8
				forval i = 1/2 {
					local b_`i' = b[1,`j'] //beta
					local se_`i' = b[2,`j'] //asymptotic s.e.
					local a_p_`i' = b[4,`j'] //asymptotic p-value
					local p_`i' = 0 //exact p-value
					local j = `j' + 6
				}
				
				local n : di %9.0fc e(N)
				local r2_a : di %9.2f e(r2_a)
				
				/*Create matrices to store estimates from Randomization inference 
				mat `v'_age_ri_b = J(2,$nbatch,.)
				mat `v'_age_ri_se = J(2,$nbatch,.)
				mat `v'_age_ri_p = J(2,$nbatch,.)*/
				
				*Randomization inference using RI dataset created
				preserve
    				forval batch = 1/$nbatch {
					   use if batch == `batch' using "$rianalysis/ri_data_final", clear	
					   *use if batch == `batch' using ri_data_final, clear
					   xtile age_med = age if ~missing(age), nq(2)
					   recode age_med (1=0) (2=1)
    				   noi di "Running hetero analysis by median age for `v' for batch - `batch' at time: `c(current_time)'"
    				   reghdfe `v' $treat_pool_sd##age_med $treat_pool_hw##age_med if $sample, a($studycontrols $covariates) vce(robust) 
    				   mat ri_b = r(table)
					   local j = 8
    				   forval i = 1/2 {
            			   local ri_b_`i' = ri_b[1,`j']
						   /*mat `v'_age_ri_b[`i',`batch'] = ri_b[1,`i'] //beta
						   mat `v'_age_ri_se[`i',`batch'] = ri_b[2,`i'] //asymptotic s.e.
					       mat `v'_age_ri_p[`i',`batch'] = ri_b[4,`i'] //asymptotic p-value*/
            			   *Two-tailed comparison
				           if abs(`ri_b_`i'') >= abs(`b_`i'') local p_`i' = `p_`i'' + 1 
						   local j = `j' + 6
					    }  
				    } 
				restore
				
				*Compute Exact p-values 
				forval i = 1/2 {
					local p_`i' = `p_`i''/$nbatch
				}
				
				*Imputing coefficients, asymptotic and exact p-values in the output matrix
				mat `v'_age = J(2,3,.)
				forval i = 1/2 {
					mat `v'_age[`i',1] = round(`b_`i'',0.001)
					mat `v'_age[`i',2] = round(`se_`i'',0.001)
					mat `v'_age[`i',3] = round(`p_`i'',0.001)
				}
				
				*Statistical significance
				mat stars = J(2,3,.)
				forval i = 1/2 {
					mat stars[`i',2] = 0
					mat stars[`i',3] = 0
					if (`a_p_`i'' < 0.1)  mat stars[`i',1] = 1
					else mat stars[`i',1] = 0
					if (`a_p_`i'' < 0.05) mat stars[`i',1] = 2 
					if (`a_p_`i'' < 0.01) mat stars[`i',1] = 3 
				}

				*Save matrix
				matsave `v'_age, replace saving path($tables)
				/*matsave `v'_age_ri_b, replace saving path($tables)
				matsave `v'_age_ri_se, replace saving path($tables)
				matsave `v'_age_ri_p, replace saving path($tables)*/
				*matload `v'_age, path($tables) saving
				
				*Output 
				frmttable, statmat(`v'_age) store(`v'_age) substat(2) annotate(stars) asymbol(*,**,***) rtitle($rtitle_pooled_age)  /// 
				addrows("Adjusted $ R^2$", `r2_a' \ N, "`n'" \ "Control Mean", `c_mean') sdec(3,3,3)	
		
			}
			
********************************************************************************
***HETEROGENEITY BY UNEMPLOYMENT STATUS
********************************************************************************

	tab occ_1, mi
	
	*Regression
		qui foreach v of varlist $keysdhw {
			
				*Control mean
				mean `v' if treatment_pooled==0 & $sample
				mat mean = r(table)
				local c_mean : di %9.2f mean[1,1]
			
				noi reghdfe `v' $treat_pool_sd##occ_1 $treat_pool_hw##occ_1 if $sample, a($studycontrols $covariates) vce(robust)
		
				mat b = r(table)
				local j = 8
				forval i = 1/2 {
					local b_`i' = b[1,`j'] //beta
					local se_`i' = b[2,`j'] //asymptotic s.e.
					local a_p_`i' = b[4,`j'] //asymptotic p-value
					local p_`i' = 0 //exact p-value
					local j = `j' + 6
				}
				
				local n : di %9.0fc e(N)
				local r2_a : di %9.2f e(r2_a)
				
				/*Create matrices to store estimates from Randomization inference 
				mat `v'_unemp_ri_b = J(2,$nbatch,.)
				mat `v'_unemp_ri_se = J(2,$nbatch,.)
				mat `v'_unemp_ri_p = J(2,$nbatch,.)*/
				
				*Randomization inference using RI dataset created
				preserve
    				forval batch = 1/$nbatch {
					   use if batch == `batch' using "$rianalysis/ri_data_final", clear					   
    				   *use if batch == `batch' using ri_data_final, clear
					   noi di "Running hetero analysis by unemployment for `v' for batch - `batch' at time: `c(current_time)'"
    				   reghdfe `v' $treat_pool_sd##occ_1 $treat_pool_hw##occ_1 if $sample, a($studycontrols $covariates) vce(robust) 
    				   mat ri_b = r(table)
					   local j = 8
    				   forval i = 1/2 {
            			   local ri_b_`i' = ri_b[1,`j']
						   /*mat `v'_unemp_ri_b[`i',`batch'] = ri_b[1,`i'] //beta
						   mat `v'_unemp_ri_se[`i',`batch'] = ri_b[2,`i'] //asymptotic s.e.
					       mat `v'_unemp_ri_p[`i',`batch'] = ri_b[4,`i'] //asymptotic p-value*/
            			   *Two-tailed comparison
				           if abs(`ri_b_`i'') >= abs(`b_`i'') local p_`i' = `p_`i'' + 1 
						   local j = `j' + 6
					    }  
				    } 
				restore
				
				*Compute Exact p-values 
				forval i = 1/2 {
					local p_`i' = `p_`i''/$nbatch
				}
				
				*Imputing coefficients, asymptotic and exact p-values in the output matrix
				mat `v'_unemp = J(2,3,.)
				forval i = 1/2 {
					mat `v'_unemp[`i',1] = round(`b_`i'',0.001)
					mat `v'_unemp[`i',2] = round(`se_`i'',0.001)
					mat `v'_unemp[`i',3] = round(`p_`i'',0.001)
				}
				
				*Statistical significance
				mat stars = J(2,3,.)
				forval i = 1/2 {
					mat stars[`i',2] = 0
					mat stars[`i',3] = 0
					if (`a_p_`i'' < 0.1)  mat stars[`i',1] = 1
					else mat stars[`i',1] = 0
					if (`a_p_`i'' < 0.05) mat stars[`i',1] = 2 
					if (`a_p_`i'' < 0.01) mat stars[`i',1] = 3 
				}

				*Save matrix
				matsave `v'_unemp, replace saving path($tables)
				/*matsave `v'_unemp_ri_b, replace saving path($tables)
				matsave `v'_unemp_ri_se, replace saving path($tables)
				matsave `v'_unemp_ri_p, replace saving path($tables)*/
				
				*Output 
				noi frmttable, statmat(`v'_unemp) store(`v'_unemp) substat(2) annotate(stars) asymbol(*,**,***) rtitle($rtitle_pooled_unemp) /// 
				addrows("Adjusted $ R^2$", `r2_a' \ N, "`n'" \ "Control Mean", `c_mean') sdec(3,3,3)	
		
			}

********************************************************************************
***COMPILE OUTPUTS
********************************************************************************
	
	qui foreach v of varlist $keysdhw {	
		outreg, replay(pooled_period) merge(`v'_pd) store(pooled_period) 
		outreg, replay(pooled_sms) merge(`v'_sms) store(pooled_sms) 
		outreg, replay(pooled_recall) merge(`v'_recall) store(pooled_recall)
		outreg, replay(pooled_age) merge(`v'_age) store(pooled_age) 
		outreg, replay(pooled_unemp) merge(`v'_unemp) store(pooled_unemp)
	}

	***Globals for outputs
	global font "basefont(scriptsize) statfont(scriptsize; scriptsize; scriptsize; scriptsize) rtitlfont(scriptsize; scriptsize; scriptsize; scriptsize) ctitlfont(scriptsize) notefont(scriptsize)"
	global lines "hlines(1{0};1{0};1{0}1;1{0}1)"
		
	***Display all results
	cd "$tables"
	foreach i in period sms recall age unemp {
		outreg using itt_`i', replace tex fr replay(pooled_`i') $font $lines note("") ///
			ct("", "Distancing", "", "Handwashing", "" \ "", "Know", "Act", "Know", "Act") multicol(1,2,2;1,4,2)		
	}

exit, clear
